<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>粘性定位</title>
		<style type="text/css">
			body{
				height: 3000px;
			}
			
			div {
				position: sticky;		/*粘性定位，必须加一个top或left等*/
				top:10px;
				margin-top: 50px;
				width: 80%;
				height: 60px;
				background: pink;

			}
		</style>
	</head>

	<body>
		<div>
			我是导航栏
		</div>
	</body>

</html>